<?php 
class uc{
	public function login($username,$password,$uid){
				$identity = new UserIdentity($username,$password,$uid);	
				$identity->authenticate();
				if($identity->errorCode===UserIdentity::ERROR_NONE){
					$duration=0; // 30 days
					Yii::app()->user->login($identity,$duration);
					}	
		}
	}
